﻿<UserControl x:Class="ExampleBrowser.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:oxy="clr-namespace:OxyPlot.Silverlight;assembly=OxyPlot.Silverlight" xmlns:local="clr-namespace:ExampleBrowser" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <local:GroupingItemsControlConverter x:Key="GroupingItemsControlConverter"/>

            <local:GroupingItemsControlConverterParameters x:Key="SimpleGroupingItemsControlConverterParameter">
                <local:GroupingItemsControlConverterParameters.GroupSelector>
                    <local:ExampleInfoGroupSelector/>
                </local:GroupingItemsControlConverterParameters.GroupSelector>

                <local:GroupingItemsControlConverterParameters.GroupHeaderTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding}" FontWeight="Bold"/>
                    </DataTemplate>
                </local:GroupingItemsControlConverterParameters.GroupHeaderTemplate>

                <local:GroupingItemsControlConverterParameters.ItemTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding Title}" Padding="8 0 0 0"/>
                    </DataTemplate>
                </local:GroupingItemsControlConverterParameters.ItemTemplate>
            </local:GroupingItemsControlConverterParameters>

        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>
        <Border Background="SkyBlue" Grid.ColumnSpan="2"/>
        <TextBlock Grid.ColumnSpan="2" Text="OxyPlot Example Browser" Foreground="White" Margin="4"/>
        <TextBlock Grid.Column="1" HorizontalAlignment="Right" Text="{Binding Version}" Foreground="White" Margin="4"/>
        <ListBox ItemsSource="{Binding Examples, Converter={StaticResource GroupingItemsControlConverter},
                    ConverterParameter={StaticResource SimpleGroupingItemsControlConverterParameter}}"
                 SelectedItem="{Binding SelectedItem, Mode=TwoWay}" Grid.Row="1" BorderThickness="0,0,1,0"/>
        <oxy:Plot Model="{Binding SelectedExample.PlotModel}" Background="{Binding PlotBackground}" Grid.Column="1" Grid.Row="1"/>
    </Grid>
</UserControl>
